10d218
@@ -41,6 +41,11 @@
import org.slf4j.LoggerFactory;
  * <p/>
  * Care should be taken to use a suitable underlying {@link java.util.Map} to avoid this class being a
  * memory leak.
+ * <p/>
+ * The default cache used is {@link LRUCache} which keeps the most used entries in the cache.
+ * When this cache is being used and the state of the cache is stored to file via {@link #trunkStore()}
+ * then the entries stored are not guaranteed to be in the exact order the entries were added to the cache.
+ * If you need exact ordering, then you need to provide a custom {@link Map} implementation that does that
  *
  * @version 
  */
@@ -202,10 +207,15 @@
public class FileIdempotentRepository extends ServiceSupport implements Idempote
     }
 
     /**
-     * Sets the cache size
+     * Sets the cache size.
+     *
+     * Setting cache size is only possible when using the default {@link LRUCache} cache implementation.
      */
     @SuppressWarnings("unchecked")
     public void setCacheSize(int size) {
+        if (cache != null && !(cache instanceof LRUCache)) {
+            throw new IllegalArgumentException("Setting cache size is only possible when using the default LRUCache cache implementation");
+        }
         if (cache != null) {
             cache.clear();
         }
